import { ENV, isProduct, isShowChangeEvn } from './index'

export const API_LOGIN_OUT_CODE = [900, 901, 902, 903, 904, 905] // 未登录code

export const ABNORMAL_CODE = [404, 500] //接口异常code

export const API_SUCCESS_CODE = 0

export const developApiUrl = 'https://DEV/开发'

export const testApiUrl = 'https://TEST/测试'

export const proApiUrl = 'https://PRO/生产'

// 网络资源文件路径
export const imageUrl = 'https://cos/生产'

// api
let envApis = {
  // 开发版、开发版
  develop: developApiUrl,

  // 测试环境
  trial: testApiUrl,

  // 正式版
  release: proApiUrl
}

// 获取缓存地址
if (!isShowChangeEvn) {
  uni.removeStorageSync('CONFIG_API_URL')
}
let storageApi = uni.getStorageSync('CONFIG_API_URL')

export const ApiUrl = (!isProduct && storageApi) || envApis[ENV]
